package com.aspose.cells;

import java.util.HashMap;

abstract class zgi implements zaft {
   protected int a;
   protected int b;
   protected int c;
   protected zaay d;
   protected HashMap e;
   protected zfv f = new zfv();
   protected zfv g;
   protected boolean h = false;
   protected boolean i = false;

   zgi(int var1, int var2, int var3, zaay var4, HashMap var5) {
      this.a = var1;
      this.b = var2;
      this.c = var3;
      this.d = var4;
      this.e = var5;
      if (!var5.containsKey("")) {
         var5.put("", 0);
      }

   }

   abstract boolean a(zyi var1);

   public boolean a(zp var1, int var2) {
      this.g = var1.c(var2, this.f);
      if (this.g.c != 5) {
         return false;
      } else if (this.h && this.g.a == this.c && var1.h() == this.b) {
         this.h = false;
         this.i = true;
         return false;
      } else if (this.a((zyi)this.g.d)) {
         this.i = true;
         return true;
      } else {
         return false;
      }
   }

   boolean a(zagu var1) {
      switch(var1.b()) {
      case 5:
         if (((zzl)var1).k()) {
            return this.a(((zaaj)var1).m());
         }

         zaag var9 = (zaag)var1;
         return this.a(var9.m()) | this.a(var9.n());
      case 6:
      default:
         return false;
      case 7:
         zzi var2 = (zzi)var1;
         zagu[] var3 = var2.n();
         if (var3 == null) {
            return false;
         } else {
            boolean var4 = false;
            zagu[] var5 = var3;
            int var6 = var3.length;

            for(int var7 = 0; var7 < var6; ++var7) {
               zagu var8 = var5[var7];
               if (this.a(var8)) {
                  var4 = true;
               }
            }

            return var4;
         }
      case 8:
         return this.a(((zzj)var1).l(this.d));
      case 9:
         return this.a(((zaal)var1).k());
      }
   }

   boolean a(zaye var1) {
      zur var2 = var1.a();
      boolean var3 = this.h;
      if (var2 != null && var2 != this.d.o) {
         if ((var2.a & '\uffff') != this.d.p.i) {
            return false;
         } else {
            Worksheet var9 = this.d.d;
            boolean var5;
            int var6;
            if (var1.m()) {
               var5 = false;
               if (var2.b == var2.c) {
                  this.d.a(this.d.p.g.get(var2.b & '\uffff'));
                  var5 = this.a(var1.b(), var1.d());
               } else {
                  var6 = var2.c & '\uffff';

                  for(int var10 = var2.b & '\uffff'; var10 <= var6; ++var10) {
                     if (var10 == this.a && var1.b() == this.b && var1.d() == this.c) {
                        var5 = true;
                     } else {
                        this.d.a(this.d.p.g.get(var10));
                        if (this.a(var1.b(), var1.d())) {
                           var5 = true;
                        }
                     }
                  }
               }

               this.d.a(var9);
               return var5;
            } else {
               var5 = this.i;
               this.i = false;
               this.h = false;
               if (var2.b == var2.c) {
                  this.d.a(this.d.p.g.get(var2.b & '\uffff'));
                  this.d.e.a(var1.u(), var1.b(), var1.d(), this, false, false);
               } else {
                  var6 = var2.c & '\uffff';
                  CellArea var7 = var1.u();

                  for(int var8 = var2.b & '\uffff'; var8 <= var6; ++var8) {
                     this.d.a(this.d.p.g.get(var8));
                     if (var8 == this.a && var1.a(this.b, this.c)) {
                        this.h = true;
                        this.d.e.a(var7, var1.b(), var1.d(), this, false, false);
                        this.h = false;
                     } else {
                        this.d.e.a(var7, var1.b(), var1.d(), this, false, false);
                     }
                  }
               }

               this.d.a(var9);
               this.h = var3;
               if (this.i) {
                  return true;
               } else {
                  if (var5) {
                     this.i = var5;
                  }

                  return false;
               }
            }
         }
      } else if (var1.m()) {
         return var1.b() == this.b && var1.d() == this.c ? true : this.a(var1.b(), var1.d());
      } else if (var1.a(this.b, this.c)) {
         this.h = true;
         this.d.e.a(var1.u(), var1.b(), var1.d(), this, false, false);
         this.h = var3;
         return true;
      } else {
         this.h = false;
         boolean var4 = this.i;
         this.i = false;
         this.d.e.a(var1.u(), var1.b(), var1.d(), this, false, false);
         if (this.i == var4) {
            return var4;
         } else {
            this.i = var4;
            this.h = var3;
            return !var4;
         }
      }
   }

   private boolean a(int var1, int var2) {
      this.f.a = (short)var2;
      this.g = this.d.e.getRows().a.a(var1, this.f, 4);
      return this.g != null && this.g.c == 5 ? this.a((zyi)this.g.d) : false;
   }
}
